package com.qnvip.sbd.controller;

import com.alibaba.fastjson.JSON;
import com.qnvip.sbd.entity.Admin;
import com.qnvip.sbd.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author EricLin
 * @Date 2017-11-17
 */
@RestController
@EnableAutoConfiguration
public class HomeController {

    @Autowired
    private AdminService adminService;

    @RequestMapping("/")
    String home() {
        return "Hello World!";
    }


    @RequestMapping("admin")
    public String admin() {
        List<Admin> list = adminService.select(new Admin(), null, null);
        System.out.println(list.get(0).getGmtTime());
        return JSON.toJSONString(list);
    }
}
